function Skills() {
	this.List = new Array();
	this.Init();
}

Skills.prototype.Init = function() {
	this.addSkill("Aestra's Falls","WIL,SPI,SPI",7,4,[],[[13,14]],"Magic","");
	this.addSkill("Axe","STR,AGI,DEX",3,3,[],[],"Combat","Axe determines your ability to hit and deal damage with axes.");
	this.addSkill("The Blizzard","SPI,SPI,WIL",7,4,[["SPI",16]],[],"Magic","");
	this.addSkill("Bow","DEX,DEX,PER",3,3,[],[],"Combat","");
	this.addSkill("Disarm Trap","DEX,DEX,INT",3,3,[],[],"General","");
	this.addSkill("Earth's Blood","SPI,SPI,WIL",7,4,[["SPI",16]],[],"Magic","");
	this.addSkill("Escape","AGI,DEX,WIL",3,3,[],[],"General","");
	this.addSkill("The First Equation","INT,INT,WIL",7,4,[],[[12,14]],"Magic","");
	this.addSkill("Flail","DEX,AGI,SPD",3,3,[],[],"Combat","");
	this.addSkill("Hand of Lightning","SPI,INT,WIL",7,4,[["SPI",14],["INT",14]],[],"Magic","");
	this.addSkill("Knife","SPD,PER,DEX",3,3,[],[],"Combat","");
	this.addSkill("Lockpick","DEX,DEX,INT",3,3,[],[],"General","");
	this.addSkill("Mace","STR,AGI,DEX",3,3,[],[],"Combat","");
	this.addSkill("Mathematics","INT,INT,INT",3,3,[["INT",14]],[],"General","");
	this.addSkill("Physician","INT,INT,DEX",3,3,[],[],"General","");
	this.addSkill("Pierce the Night","SPI,INT,WIL",7,4,[["SPI",14],["INT",14]],[],"Magic","");
	this.addSkill("Ripple","WIL,WIL,SPI",7,4,[["WIL",16]],[],"Magic","");
	this.addSkill("Search","PER,PER,INT",3,3,[],[],"General","");
	this.addSkill("Staff","DEX,AGI,SPD",3,3,[],[],"Combat","");
	this.addSkill("Swim","STR,DEX,AGI",0,3,[],[],"General","");
	this.addSkill("Sword","DEX,AGI,PER",3,3,[],[],"Combat","");
	this.addSkill("Thrown","DEX,PER,STR",3,3,[],[],"Combat","");
	this.addSkill("Trade","CHA,PER,WIL",3,3,[],[],"General","");
	this.addSkill("Unarmed","STR,DEX,SPD",0,3,[],[],"Combat","Unarmed determines your ability to hit and deal damage without a weapon.");
	this.addSkill("Widow Weave","CHA,WIL,WIL",7,4,[["CHA",16]],[],"Magic","");
	this.addSkill("Wind's Whisper","SPI,SPI,INT",7,4,[["SPI",16]],[],"Magic","");
}

Skills.prototype.addSkill = function(name,attrbs,fcost,icost,areq,sreq,type,desc) {
	var i=this.List.length;
	this.List[i] = new Object();
	this.List[i].Name=name;
	this.List[i].Attrbs=attrbs;
	this.List[i].FCost=fcost;
	this.List[i].ICost=icost;
	this.List[i].AReq=areq;
	this.List[i].SReq=sreq;
	this.List[i].Type=type;
	this.List[i].Desc=desc;
}

Skills.prototype.checkReqs = function(c,sk) {
	//Check Attribute Requirements
	for(var i=0;i<this.List[sk].AReq.length;i++) {
		if (c.Stats[this.List[sk].AReq[i][0]] < this.List[sk].AReq[i][1]) return -1;
	}
	
	//Check Skill Requirements
	for(var i=0;i<this.List[sk].SReq.length;i++) {
		if (c.Skills[this.List[sk].SReq[i][1]][0] < this.List[sk].SReq[i][1]) return -2;
	}
	
	return 1;
}

Skills.prototype.calcSkillStart = function(c) {
	var attrbs;
	for(var i=0;i<this.List.length;i++) {
		attrbs = this.List[i].Attrbs.split(",");
		c.Skills[i] = new Array(3);
		c.Skills[i][0] = this.initLvl(c,attrbs);
		c.Skills[i][1] = 0;
		c.Skills[i][2] = 0;
		if (this.List[i].FCost==0) {
			c.Skills[i][1]=1;
		} else if (this.List[i].FCost < 7) {
			c.Skills[i][0]=Math.ceil(c.Skills[i][0]/2);
		} else {
			c.Skills[i][0]=0;
		}
	}
}

Skills.prototype.initLvl = function(c,a) {
	var total = c.Stats[a[0]]+c.Stats[a[1]]+c.Stats[a[2]];
	if (total < 10) return 2;
	if (total < 13) return 3;
	if (total < 17) return 4;
	if (total < 21) return 5;
	if (total < 25) return 6;
	if (total < 29) return 7;
	if (total < 32) return 8;
	if (total < 36) return 9;
	if (total < 40) return 10;
	if (total < 44) return 11;
	if (total < 47) return 12;
	if (total < 51) return 13;
	if (total < 55) return 14;
	if (total < 59) return 15;
	if (total < 62) return 16;
	return 17;
}

Skills.prototype.menu = function(c,s) {
	var arr = new Array(11);
	var temp;
	for(var i=-5;i<6;i++) {
		temp="";
		if (s+i < 0) {
			arr[i+5] = "                                        ";
		} else if (s+i >= this.List.length) {
			arr[i+5] = "                                        ";
		} else {
			arr[i+5] = this.List[s+i].Name+"";
			while(arr[i+5].length < 30) {
				arr[i+5] += " ";
			}
			arr[i+5] += "("+this.List[s+i].FCost+"+"+this.List[s+i].ICost+")"
			temp=""+c.Skills[s+i][0];
			while((arr[i+5]+temp).length < 40) {
				arr[i+5] += " ";
			}
			arr[i+5] += temp;
		}
	}
	
	return arr;
}